extends Node2D


# Called when the node enters the scene tree for the first time.
var spriteList:Array
func _ready() -> void:
	$上层.texture = $上层地面.get_texture()
	$底层.texture = $底层地面.get_texture()
	$"上层".modulate.a = 0.3
	$"底层地面/树叶".position.z+=-5
	for i in range(0,5):
		spriteList.append($"底层地面/树叶".duplicate())
		$"底层地面".add_child(spriteList[i])
		var rz = -1 * randf() * 25
		var rx = randf() * 5.0 + 28.0
		var sc = randf() *0.5 + 0.3
		var rt = randi() % -10 +10
		spriteList[i].rotation_degrees = Vector3(90,rt,0)
		spriteList[i].scale = Vector3(sc,1,sc)
		spriteList[i].position.z = rz
		spriteList[i].position.x = rx
	pass # Replace with function body.
		

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	
	for i:Sprite3D in spriteList:
		i.position.z+=0.01
		if i.position.z > 8:
			var rz = -1 * randf() * 50
			var rx = randf() * 5 + 28
			var sc = randf() *0.4 + 0.2
			var rt = -(randi() % -10) +10
			i.rotation_degrees = Vector3(90,rt,0)
			i.scale = Vector3(sc,1,sc)
			i.position.z = rz
			i.position.x = rx
			
			#i.rotation_degrees().y
	pass
